package com.shd.edanpei.base;

import android.app.Application;
import android.content.Context;
import android.os.StrictMode;

import com.mob.MobSDK;
import com.shd.edanpei.R;
import com.umeng.commonsdk.UMConfigure;


import cn.jpush.android.api.CustomPushNotificationBuilder;
import cn.jpush.android.api.JPushInterface;

public class MyApplication extends Application {

    private static MyApplication instance;

    @Override
    public void onCreate() {
        super.onCreate();
        instance = this;
        // queryAndLoadNewPatch不可放在attachBaseContext 中，否则无网络权限，建议放在后面任意时刻，如onCreate中
       // SophixManager.getInstance().queryAndLoadNewPatch();
        MobSDK.init(this);
        JPushInterface.init(this);
//        CustomPushNotificationBuilder builderNot = new
//                CustomPushNotificationBuilder(this,
//                R.layout.customer_notitfication_layout,
//                R.id.icon,
//                R.id.title,
//                R.id.text);
//        // 指定定制的 Notification Layout
//        builderNot.statusBarDrawable = R.drawable.logo;
//        // 指定最顶层状态栏小图标
//        builderNot.layoutIconDrawable = R.drawable.line_blue;
//        // 指定下拉状态栏时显示的通知图标
//        JPushInterface.setPushNotificationBuilder(2, builderNot);
        // android 7.0系统解决拍照的问题
        StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder();
        StrictMode.setVmPolicy(builder.build());
        builder.detectFileUriExposure();

        /*
        注意: 即使您已经在AndroidManifest.xml中配置过appkey和channel值，
        也需要在App代码中调用初始化接口（如需要使用AndroidManifest.xml
        中配置好的appkey和channel值，UMConfigure.init调用中appkey和channel
        参数请置为null）。5c81ff1b0cafb272b3000223
        */
        UMConfigure.init(this,UMConfigure.DEVICE_TYPE_PHONE, "5d0c343e570df31ca200070b");
       // UMConfigure.init(this, "5c81ff1b0cafb272b3000223", "Umeng", UMConfigure.DEVICE_TYPE_PHONE, null);
        /**
         * 设置组件化的Log开关
         * 参数: boolean 默认为false，如需查看LOG设置为true
         */
        UMConfigure.setLogEnabled(false);

    }

    public static MyApplication getInstance() {
        return instance;
    }

    public static Context getApplication() {
        return instance.getApplicationContext();
    }

}
